/**
 * 方法修饰符工厂函数
 */
// function enumerable(bool: boolean) {
//   return (target: any, peopertyName: string, descriptor: PropertyDescriptor) => {
//     descriptor.enumerable = bool
//   }
// }

// class People {
//   constructor(public name: string) {
//   }
//   @enumerable(false)
//   getName(){
//     return this.name
//   }
// }

// const man = new People('Wick')
// for (const key in man) {
//   console.log(key)
// }

/**
 * 属性描述符 
 */
// function printPropertyName(target: any, propertyName: string) {
//   console.log(propertyName)
// }
// class Class {
//   @printPropertyName
//   public name: string = ''
// }
// const a = new Class()
// for (const key in a) {
//   console.log(key)
// }

/**
 * 参数修饰符 
 */
function required(target: any, propertyName: string, index: number) {
  console.log(`修饰的是${propertyName}的第${index + 1}个参数。`)
}
class Class {
  public name: string = ''
  public age: number = 18
  public getInfo(@required prefix: string, @required infoType: string): any {
    return `${prefix} ${[infoType]}`
  }
}
const a = new Class()
console.log(a.getInfo('+++++++++', 'age'))